package com.example.validatestudy.demos.jdk8;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;
import java.util.Optional;

/**
 * @auther: 王振方
 * @date: 2023 03 16 16 28
 * @description:
 */
@Data
public class User {

    private Integer id;
    private String name;
    private String sex;
    private String hobbies;
    private List<String> hList;
    private int age;
    private Optional<Address> address;

    public User() {
        this.address = Optional.of(new Address("河南"));
    }

    public User(String name) {
        this.name = name;
        this.address = Optional.of(new Address("河南"));
    }

    public User(Integer id, String name, String sex, int age) {
        this.id = id;
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.address = Optional.of(new Address("河南"));
    }

    /**
     * 内部类
     */
    @Data
    @AllArgsConstructor
    class Address{
        private String city;
    }

    public void study(String bookName){
        System.out.println(name+"开始读书："+bookName);
    }


}
